home *** CD-ROM | disk | FTP | other *** search
- Path: prairienet.org!sjmccaug
- From: sjmccaug@prairienet.org (Scott J. McCaughrin)
- Newsgroups: comp.lang.c++
- Subject: Re: [Q] Dynamically allocating memory for a char*
- Date: 20 Jan 1996 03:58:19 GMT
- Organization: University of Illinois at Urbana
- Message-ID: <4dpp8r$5sv@vixen.cso.uiuc.edu>
- References: <ALUN.CHAMPION.96Jan19155029@g7240065.bridge.bst.bls.com> <4dmn1i$10t@walrus2.walrus.com>
- Reply-To: sjmccaug@prairienet.org (Scott J. McCaughrin)
- NNTP-Posting-Host: firefly.prairienet.org
-
-
- In a previous article, Alun.Champion@bridge.bst.bls.com (Alun Champion) says:
-
- >In article <NITIN.96Jan19095012@more.eng.sun.com> nitin@more.eng.sun.com (Nitin More [CONTRACTOR]) writes:
- >
- >: [original attribution not included in response]
- >: > I have a question about allocating memory for a string as it's passed
- >: > in by the user. I'm using cin to get the info, but maybe this is
- >: > inappropriate. I have included the relevant snippets of the file
- >: > below. What I am trying to achieve is no limitation for the user when
- >: > they input a path + filename. Is it possible to use char* foo and
- >: > then something like (I know this is wrong, but the idea of it ...)
- >
- Isn't this one of the prime motives for using linked lists? Decide on a
- size for each node (= no. of chars) and add on new links dynamlically
- until the string is read in, then collapse the nodes into one char array!
-
- -- Scott McC.
-
-